---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: alerts-receiver
  namespace: d8-monitoring
  {{- include "helm_lib_module_labels" (list . (dict "app" "alerts-receiver")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: d8:prometheus:alerts-receiver
  {{- include "helm_lib_module_labels" (list . (dict "app" "alerts-receiver")) | nindent 2 }}
rules:
  - apiGroups: ["deckhouse.io"]
    resources:
    - clusteralerts
    - clusteralerts/status
    verbs:
    - get
    - list
    - create
    - update
    - patch
    - delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:prometheus:alerts-receiver
  {{- include "helm_lib_module_labels" (list . (dict "app" "alerts-receiver")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:prometheus:alerts-receiver
subjects:
- kind: ServiceAccount
  name: alerts-receiver
  namespace: d8-monitoring
